package com.kly.user.db.dao.impl;

import com.fqgj.common.base.AbstractBaseMapper;
import com.google.common.collect.Maps;
import com.kly.user.db.dao.IssueUsersDao;
import com.kly.user.db.entity.IssueUsersDetailEntity;
import com.kly.user.db.entity.IssueUsersEntity;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;

/**
 * User: user
 * Date: 2024-01-11
 * Time: 21:16:28.858
 */

@Repository
public class IssueUsersDaoImpl extends AbstractBaseMapper<IssueUsersEntity> implements IssueUsersDao {

    @Override
    public List<IssueUsersEntity> getIssueUsersList(Integer limitCount) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("limitCount", limitCount);
        return this.getSqlSession().selectList(this.getStatement("getIssueUsersList"), params);
    }

    @Override
    public List<IssueUsersDetailEntity> getIssueUsersListV2(Integer limitCount) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("limitCount", limitCount);
        return this.getSqlSession().selectList(this.getStatement("getIssueUsersListV2"), params);
    }

    @Override
    public List<IssueUsersEntity> getNoneOrganicUsers(Integer limitCount) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("limitCount", limitCount);
        return this.getSqlSession().selectList(this.getStatement("getNoneOrganicUsers"), params);
    }

    @Override
    public int deleteByUserCode(String userCode) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("userCode", userCode);
        return this.getSqlSession().delete(this.getStatement("deleteByUserCode"), params);
    }

    @Override
    public int deleteByUseStatus(int useStatus) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("useStatus", useStatus);
        return this.getSqlSession().delete(this.getStatement("deleteByUseStatus"), params);
    }

    @Override
    public int updateUseStatus(int useStatus) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("useStatus", useStatus);
        return this.getSqlSession().update(this.getStatement("updateUseStatus"), params);
    }
}